/*
 * DBTableModel.java
 */

package org.owasp.scrubbr.db.report;

import org.owasp.scrubbr.db.Table;
import javax.swing.event.TableModelListener;
import javax.swing.table.TableModel;

public class DBTableModel implements TableModel {
    
    private Table t;
    /** Creates a new instance of DBTableModel */
    public DBTableModel(Table t) {
        this.t = t;
    }
    
    public Table getTable() {
        return t;
    }

    public int getRowCount() {
        return t.getTaintedRows().size();
    }

    public int getColumnCount() {
        
        if ( t.getTaintedRows().size() > 0 ) {
            return t.getTaintedRows().get(0).getAllTuples().size();    
        }

        return 0;
    }

    public String getColumnName(int i) {
        return t.getTaintedRows().get(0).getAllTuples().get(i).getName();
    }

    public boolean isCellEditable(int i, int i0) {
        return false;
    }

    public Object getValueAt(int x, int y) {
        return t.getTaintedRows().get(x).getAllTuples().get(y);
    }

    public void setValueAt(Object object, int i, int i0) {
    }

    public void addTableModelListener(TableModelListener tableModelListener) {
    }    

    public Class<String> getColumnClass(int i) {
        return String.class;
    }

    public void removeTableModelListener(TableModelListener tableModelListener) {
        
    }
}
